export default function () {
  if (!wx.getStorageSync("cookies")) {
    // 没有权限
    wx.showModal({
      title: "请先登录",
      content: "该功能需要登录账号才能使用",
      confirmText: "去登陆",
      cancelText: "回到首页",
      success({ confirm }) {
        if (confirm) {
          console.log("登录");
          wx.redirectTo({
            url: "/pages/login/login",
          });
        } else {
          console.log("首页");
          wx.switchTab({
            url: '/pages/index/index',
          });
        }
      },
      fail: () => {
        console.log("失败");
      },
    });
    return true;
  }
  return false;
}
